/**
 * @param {number[]} target
 * @param {number} n
 * @return {string[]}
 */
 var buildArray = function(target, n) {
  let strArr = []
  let len = target[target.length-1]<n? target[target.length-1]:n
  for(let i=1;i<=len;i++){
    strArr.push('Push')
    if(!target.includes(i)){
      strArr.push('Pop')
    }
  }
  return strArr
};
console.log(buildArray([1,2],4));
